package com.example.xunai.dto.request.user;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import jakarta.validation.constraints.NotBlank;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserLoginRequest {
    @NotBlank(message = "用户名不能为空")
    private String username;

    @NotBlank(message = "密码不能为空")
    private String password;

    private Boolean rememberMe = false;

    // 如果需要静态工厂方法，可以添加
    public static UserLoginRequest of(String username, String password) {
        return new UserLoginRequest(username, password, false);
    }

    public static UserLoginRequest of(String username, String password, Boolean rememberMe) {
        return new UserLoginRequest(username, password, rememberMe);
    }

    public boolean isValid() {
        return username != null && !username.trim().isEmpty()
                && password != null && !password.trim().isEmpty();
    }
}